﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CILADA.Core.Graph
{
    public abstract class IMember
    {
        public string FullName { get; set; }
        public string DisplayName { get; set; }
        public Visibility AccessLevel { get; set; }

        public IMember(){}

        public IMember(string fullName)
        {
            this.FullName = fullName;
        }

        public virtual bool IsMethod()
        {
            return false;
        }
        public virtual bool IsType()
        {
            return false;
        }
        public virtual bool IsAttribute()
        {
            return false;
        }

        public string DisplayString()
        {
            if (!String.IsNullOrEmpty(this.DisplayName))
            {
                return this.DisplayName + " {" + this.FullName + " }";
            }
            else
            {
                return this.ToString();
            }
        }

        public override string ToString()
        {
            return this.FullName.ToString();
        }

        public override bool Equals(object obj)
        {
            Type thisObjType = this.GetType();
            Type thatObjType = obj.GetType();
            if (thisObjType.Equals(thatObjType))
            {
                IMember that = obj as IMember;
                if (that.FullName.Equals(this.FullName))
                {
                    return true;
                }
            }
            return false;
        }

        public override int GetHashCode()
        {
            return this.FullName.GetHashCode();
        }
    }
}
